home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s3.arc / PIBHOSTA.MOD < prev    next >
Encoding:
Text File  |  1987-09-08  |  38.6 KB  |  821 lines

  1. PROCEDURE Emulate_Host;
  2.  
  3. (*----------------------------------------------------------------------*)
  4. (*               PibHost --- Host mode (mini-BBS) for PibTerm           *)
  5. (*----------------------------------------------------------------------*)
  6. (*                                                                      *)
  7. (*  Author:   Philip R. Burns                                           *)
  8. (*  Date:     February, 1986                                            *)
  9. (*  Version:  1.0  (July, 1985)                                         *)
  10. (*            1.1  (July, 1985)                                         *)
  11. (*            1.2  (August, 1985)                                       *)
  12. (*            2.0  (August, 1985)                                       *)
  13. (*            3.0  (October, 1985)                                      *)
  14. (*            3.2  (November, 1985)                                     *)
  15. (*            4.0  (June, 1987)                                         *)
  16. (*                                                                      *)
  17. (*  Systems:  For MS-DOS on IBM PCs and close compatibles only.         *)
  18. (*            Note:  I have checked these on Zenith 151s under          *)
  19. (*                   MSDOS 2.1 and IBM PCs under PCDOS 2.0.             *)
  20. (*                                                                      *)
  21. (*  Overview: This overlay provides a simple host mode for use with     *)
  22. (*            PibTerm.  Facilities are provided for message leaving     *)
  23. (*            and file transfer.  This code can be used as a very       *)
  24. (*            simple remote bulletin board.  However, it lacks the      *)
  25. (*            security provisions needed for a genuine BBS, and is      *)
  26. (*            really intended to cover the need for a simple remote     *)
  27. (*            facility for a small private group of users.              *)
  28. (*                                                                      *)
  29. (*            Beginning with version 4.0, it is also possible for       *)
  30. (*            designated users to jump to DOS and thus run DOS commands *)
  31. (*            from the remote system.                                   *)
  32. (*                                                                      *)
  33. (*  Use:      This code assumes a Hayes-compatible modem.  You may need *)
  34. (*            to modify the code if your modem doesn't return verbal    *)
  35. (*            codes sufficient to determine the baud rate of the caller.*)
  36. (*            The modem is assumed to be set to answer the phone        *)
  37. (*            automatically.                                            *)
  38. (*                                                                      *)
  39. (*            To invoke host mode after entering PibTerm, enter Alt-W.  *)
  40. (*                                                                      *)
  41. (*            If you want the remote session echoed to the printer or   *)
  42. (*            captured to disk, then use the Alt-L and Alt-O commands   *)
  43. (*            before using Alt-W to invoke host mode.                   *)
  44. (*                                                                      *)
  45. (*            The following files are required above those normally     *)
  46. (*            used with PibTerm:                                        *)
  47. (*                                                                      *)
  48. (*              PIBTERM.USF  --- the user file.  A simple text file     *)
  49. (*                               containing the first name, last name,  *)
  50. (*                               and password for each authorized user. *)
  51. (*                               This file can be created using any     *)
  52. (*                               text editor that produces ascii files. *)
  53. (*                               The format is simply:                  *)
  54. (*                                                                      *)
  55. (*                                  firstname;lastname;password;priv    *)
  56. (*                                                                      *)
  57. (*                               i.e., semicolons separating the first  *)
  58. (*                               name, last name, password, and         *)
  59. (*                               privilege level.  At present, the only *)
  60. (*                               privilege levels are 'N' for normal    *)
  61. (*                               users and 'S' for special users.       *)
  62. (*                                                                      *)
  63. (*                               This file MUST be created outside of   *)
  64. (*                               PibTerm;  there are no provisions for  *)
  65. (*                               a remote caller to get added to the    *)
  66. (*                               user file.                             *)
  67. (*                                                                      *)
  68. (*              PIBTERM.MSG ---  The message file.  This file is also   *)
  69. (*                               a simple ascii text file.  Message     *)
  70. (*                               header information is flagged by '=='  *)
  71. (*                               in columns one and two.  The end of a  *)
  72. (*                               message is marked by '== End' in       *)
  73. (*                               column one.  This file will be created *)
  74. (*                               by PibTerm if it doesn't exist when a  *)
  75. (*                               host session requires its presence.    *)
  76. (*                                                                      *)
  77. (*                               To remove messages, use a text editor  *)
  78. (*                               and just delete the header lines and   *)
  79. (*                               text for a message.  There are no      *)
  80. (*                               provisions for deleting messages       *)
  81. (*                               remotely.                              *)
  82. (*                                                                      *)
  83. (*              PIBTERM.XFR ---  The file transfer list.  This file     *)
  84. (*                               contains a list of files which may be  *)
  85. (*                               downloaded by a remote user.  Files    *)
  86. (*                               NOT on the transfer list cannot be     *)
  87. (*                               downloaded.                            *)
  88. (*                                                                      *)
  89. (*                               Also, a file with the same name as a   *)
  90. (*                               file on this list cannot be uploaded   *)
  91. (*                               by a remote user.                      *)
  92. (*                                                                      *)
  93. (*                               If the file name begins with an '*',   *)
  94. (*                               then that file is protected, and it    *)
  95. (*                               can neither be uploaded nor downloaded.*)
  96. (*                               All the PibTerm files should be placed *)
  97. (*                               in PIBTERM.XFR with an '*' preceding   *)
  98. (*                               the name.  For example:                *)
  99. (*                                                                      *)
  100. (*                                   *PIBTERM.XFR                       *)
  101. (*                                                                      *)
  102. (*              PIBTERM.CMT ---  private comments file -- only readable *)
  103. (*                               by you.  The format is the same as the *)
  104. (*                               message file.                          *)
  105. (*                                                                      *)
  106. (*              PIBTERM.LOG ---  log file telling who logged on and     *)
  107. (*                               when they logged off.                  *)
  108. (*                                                                      *)
  109. (*              PIBTERM.WEL ---  Welcome message file issued after a    *)
  110. (*                               sucessful login.                       *)
  111. (*                                                                      *)
  112. (*            Note that all these files are simple sequential ascii     *)
  113. (*            files. This implies that they should be kept small for    *)
  114. (*            reasonable performance -- which is fine for a small group *)
  115. (*            of users.  This implementation does not provide good      *)
  116. (*            performance for a large group of users;  if you need that,*)
  117. (*            you should obtain a real BBS program designed to handle   *)
  118. (*            large numbers of users.                                   *)
  119. (*                                                                      *)
  120. (*                                                                      *)
  121. (*----------------------------------------------------------------------*)
  122. (*                                                                      *)
  123. (*                            Restriction                               *)
  124. (*                            -----------                               *)
  125. (*                                                                      *)
  126. (*           You may use this code only for NON COMMERCIAL purposes     *)
  127. (*           unless you explicitly obtain my permission.  I take a dim  *)
  128. (*           view of others making money on my work and those of other  *)
  129. (*           people whose code I've inserted here.                      *)
  130. (*                                                                      *)
  131. (*           Please feel free to add new features.  I wrote this        *)
  132. (*           program to give people a useful and usable basic terminal  *)
  133. (*           facility, and to show how Turbo Pascal can be used for     *)
  134. (*           asynchronous communications, menu display, windowing, and  *)
  135. (*           so on.  I hope that you find this program useful -- and,   *)
  136. (*           if you expand upon it, please upload your extensions so    *)
  137. (*           that all of us can enjoy them!                             *)
  138. (*                                                                      *)
  139. (*----------------------------------------------------------------------*)
  140. (*                                                                      *)
  141. (*           Suggestions for improvements or corrections are welcome.   *)
  142. (*           Please leave messages on Gene Plantz's BBS (312) 882 4145  *)
  143. (*           or Ron Fox's BBS (312) 940 6496.                           *)
  144. (*                                                                      *)
  145. (*----------------------------------------------------------------------*)
  146.  
  147. (*----------------------------------------------------------------------*)
  148. (*                    Global host mode variables                        *)
  149. (*----------------------------------------------------------------------*)
  150.  
  151. CONST
  152.    MaxUsers      = 100             (* Maximum number of users supported *);
  153.    Page_Size     = 23              (* No. lines per screen for display  *);
  154.    Max_Login_Try = 3               (* Max. number of tries for login    *);
  155.  
  156. TYPE                               (* Information about a user *)
  157.  
  158.    User_Record = RECORD
  159.                     First_Name: STRING[20];
  160.                     Last_Name : STRING[20];
  161.                     Password  : STRING[10];
  162.                     Privilege : STRING[1];
  163.                  END;
  164.  
  165.    User_List_Type     = ARRAY[1 .. MaxUsers] OF User_Record;
  166.    User_List_Ptr_Type = ^User_List_Type;
  167.  
  168. VAR
  169.  
  170.    Done              : BOOLEAN     (* If session complete        *);
  171.    Really_Done       : BOOLEAN     (* To leave host mode         *);
  172.  
  173.    Kbd_Input         : BOOLEAN     (* Input found at host keybrd *);
  174.    Fname             : ShortStr    (* First name of caller       *);
  175.    Lname             : ShortStr    (* Last name of caller        *);
  176.    PassWord          : ShortStr    (* Password to access system  *);
  177.    First_Time        : BOOLEAN     (* If first time host mode up *);
  178.    Recipient_Name    : FileStr     (* Name for message reception *);
  179.    Message_Subject   : AnyStr      (* Subject of message         *);
  180.    Message_Line      : AnyStr      (* Text line for message      *);
  181.  
  182.    CR_LF_Host        : STRING[2]   (* CR or CR+LF                *);
  183.    Expert_On         : BOOLEAN     (* TRUE to use short menus    *);
  184.  
  185.    Message_File      : Text_File   (* Message file               *);
  186.  
  187.                                    (* User list *)
  188.  
  189.    User_List         : User_List_Ptr_Type;
  190.  
  191.    NUsers            : INTEGER     (* Number of active users     *);
  192.  
  193.    Cur_User          : INTEGER     (* Current user               *);
  194.    Cur_User_Name     : FileStr     (* Current user's name        *);
  195.  
  196.    NMessages         : INTEGER     (* Number of messages         *);
  197.  
  198.    Local_Host        : BOOLEAN     (* TRUE if local host session *);
  199.    Host_Section      : CHAR        (* Which section are we in?   *);
  200.    Last_Host_Sect    : CHAR        (* Section we were in before  *);
  201.                                    (* gossip mode started        *)
  202.    Blank_Time        : REAL        (* Time between sessions      *);
  203.  
  204.    Save_Upload       : FileStr     (* Save emul. mode upload path   *);
  205.    Save_Download     : FileStr     (* Save emul. mode download path *);
  206.    Save_Review       : BOOLEAN     (* Save review mode              *);
  207.    Save_Logging      : BOOLEAN     (* Save logging status           *);
  208.    Ierr              : INTEGER     (* I/O error flag                *);
  209.    New_Baud          : INTEGER     (* New baud rate                 *);
  210.    Save_H_Parity     : CHAR        (* Saves parity                  *);
  211.    Save_H_Data_Bits  : INTEGER     (* Saves data bits               *);
  212.    Save_H_Stop_Bits  : INTEGER     (* Saves stop bits               *);
  213.    Save_H_Baud_Rate  : INTEGER     (* Saves baud rate               *);
  214.    Cur_Host_Status   : ShortStr    (* Current host status for disp. *);
  215.  
  216. (*----------------------------------------------------------------------*)
  217. (*        Host_Carrier_Detect --- Check for carrier or local mode       *)
  218. (*----------------------------------------------------------------------*)
  219.  
  220. FUNCTION Host_Carrier_Detect : BOOLEAN;
  221.  
  222. (*----------------------------------------------------------------------*)
  223. (*                                                                      *)
  224. (*     Function:  Host_Carrier_Detect                                   *)
  225. (*                                                                      *)
  226. (*     Purpose:   Reports on carrier detect/local host mode status      *)
  227. (*                                                                      *)
  228. (*     Calling sequence:                                                *)
  229. (*                                                                      *)
  230. (*        Carrier := Host_Carrier_Detect : BOOLEAN;                     *)
  231. (*                                                                      *)
  232. (*           Carrier --- set TRUE if local host session, or if          *)
  233. (*                       carrier detected for remote session.           *)
  234. (*                                                                      *)
  235. (*----------------------------------------------------------------------*)
  236.  
  237. BEGIN (* Host_Carrier_Detect *)
  238.  
  239.    Host_Carrier_Detect := FALSE;
  240.  
  241.    IF Local_Host THEN
  242.       Host_Carrier_Detect := TRUE
  243.    ELSE
  244.       Host_Carrier_Detect := Async_Carrier_Detect;
  245.  
  246. END   (* Host_Carrier_Detect *);
  247.  
  248. (*----------------------------------------------------------------------*)
  249. (*        Host_Send  ---  Send character to port/screen in host mode    *)
  250. (*----------------------------------------------------------------------*)
  251.  
  252. PROCEDURE Host_Send( Ch : CHAR );
  253.  
  254. (*----------------------------------------------------------------------*)
  255. (*                                                                      *)
  256. (*     Procedure:  Host_Send                                            *)
  257. (*                                                                      *)
  258. (*     Purpose:    Sends character to comm port and/or screen           *)
  259. (*                                                                      *)
  260. (*     Calling sequence:                                                *)
  261. (*                                                                      *)
  262. (*        Host_Send( Ch : CHAR );                                       *)
  263. (*                                                                      *)
  264. (*           Ch --- character to be sent out                            *)
  265. (*                                                                      *)
  266. (*     Remarks:  If local host session, character is NOT sent out port. *)
  267. (*                                                                      *)
  268. (*----------------------------------------------------------------------*)
  269.  
  270. BEGIN (* Host_Send *)
  271.  
  272.    IF ( NOT Local_Host ) THEN
  273.       Async_Send( Ch );
  274.  
  275.    WRITE( Ch );
  276.  
  277. END   (* Host_Send *);
  278.  
  279. (*----------------------------------------------------------------------*)
  280. (*   Host_Send_String  ---  Send string to port/screen in host mode     *)
  281. (*----------------------------------------------------------------------*)
  282.  
  283. PROCEDURE Host_Send_String( S : AnyStr );
  284.  
  285. (*----------------------------------------------------------------------*)
  286. (*                                                                      *)
  287. (*     Procedure:  Host_Send_String                                     *)
  288. (*                                                                      *)
  289. (*     Purpose:    Sends string to comm port and/or screen              *)
  290. (*                                                                      *)
  291. (*     Calling sequence:                                                *)
  292. (*                                                                      *)
  293. (*        Host_Send_String( S : AnyStr );                               *)
  294. (*                                                                      *)
  295. (*           S --- character to be sent out                             *)
  296. (*                                                                      *)
  297. (*     Remarks:  If local host session, string is NOT sent out port.    *)
  298. (*                                                                      *)
  299. (*----------------------------------------------------------------------*)
  300.  
  301. BEGIN (* Host_Send_String *)
  302.  
  303.    IF ( NOT Local_Host ) THEN
  304.       Async_Send_String( S );
  305.  
  306.    WRITE( S );
  307.  
  308.    IF Printer_On THEN
  309.       WRITE( Lst, S );
  310.  
  311.    IF Capture_On THEN
  312.       WRITE( Capture_File , S );
  313.  
  314. END   (* Host_Send_String *);
  315.  
  316. (*----------------------------------------------------------------------*)
  317. (*   Host_Send_String_With_CR --- Append CR or CR+LF and send string    *)
  318. (*----------------------------------------------------------------------*)
  319.  
  320. PROCEDURE Host_Send_String_With_CR( S : AnyStr );
  321.  
  322. (*----------------------------------------------------------------------*)
  323. (*                                                                      *)
  324. (*     Procedure: Host_Send_String_With_CR                              *)
  325. (*                                                                      *)
  326. (*     Purpose:   Appends end-of-line characters to string and sends    *)
  327. (*                it out over communications port.                      *)
  328. (*                                                                      *)
  329. (*     Calling sequence:                                                *)
  330. (*                                                                      *)
  331. (*        Host_Send_String_With_CR( S: AnyStr );                        *)
  332. (*                                                                      *)
  333. (*           S --- string to be sent out.                               *)
  334. (*                                                                      *)
  335. (*     Remarks:                                                         *)
  336. (*                                                                      *)
  337. (*        The end-of-line characters are either a CR or a CR+LF,        *)
  338. (*        depending upon the choice made by the user at login time.     *)
  339. (*                                                                      *)
  340. (*----------------------------------------------------------------------*)
  341.  
  342. BEGIN (* Host_Send_String_With_CR *)
  343.  
  344.    IF ( NOT Local_Host ) THEN
  345.       Async_Send_String( S + CR_LF_Host );
  346.  
  347.    WRITELN( S );
  348.  
  349.    IF Printer_On THEN
  350.       WRITELN( Lst, S );
  351.  
  352.    IF Capture_On THEN
  353.       WRITELN( Capture_File , S );
  354.  
  355. END   (* Host_Send_String_With_CR *);
  356.  
  357. (*----------------------------------------------------------------------*)
  358. (*    Host_Send_String_And_Echo --- Send string and echo it to screen   *)
  359. (*----------------------------------------------------------------------*)
  360.  
  361. PROCEDURE Host_Send_String_And_Echo( S : AnyStr );
  362.  
  363. (*----------------------------------------------------------------------*)
  364. (*                                                                      *)
  365. (*     Procedure: Host_Send_String_And_Echo                             *)
  366. (*                                                                      *)
  367. (*     Purpose:   Send string out com port and echo to screen           *)
  368. (*                                                                      *)
  369. (*     Calling sequence:                                                *)
  370. (*                                                                      *)
  371. (*        Host_Send_String_And_Echo( S: AnyStr );                       *)
  372. (*                                                                      *)
  373. (*           S --- string to be sent out and echoed.                    *)
  374. (*                                                                      *)
  375. (*----------------------------------------------------------------------*)
  376.  
  377. BEGIN (* Host_Send_String_And_Echo *)
  378.  
  379.    IF ( NOT Local_Host ) THEN
  380.       Async_Send_String( S );
  381.  
  382.    WRITE( S );
  383.  
  384.    IF Printer_On THEN
  385.       WRITE( Lst, S );
  386.  
  387.    IF Capture_On THEN
  388.       WRITE( Capture_File , S );
  389.  
  390. END   (* Host_Send_String_And_Echo *);
  391.  
  392. (*----------------------------------------------------------------------*)
  393. (*    Host_Prompt_And_Read_String --- Get string from remote and echo   *)
  394. (*----------------------------------------------------------------------*)
  395.  
  396. PROCEDURE Host_Prompt_And_Read_String(      Prompt : AnyStr;
  397.                                         VAR S      : AnyStr;
  398.                                             Echo   : BOOLEAN );
  399.  
  400. (*----------------------------------------------------------------------*)
  401. (*                                                                      *)
  402. (*     Procedure: Host_Prompt_And_Read_String                           *)
  403. (*                                                                      *)
  404. (*     Purpose:   Issues prompt to remote user, reads response, and     *)
  405. (*                echos response.                                       *)
  406. (*                                                                      *)
  407. (*     Calling sequence:                                                *)
  408. (*                                                                      *)
  409. (*        Host_Prompt_And_Read_String(      Prompt : AnyStr;            *)
  410. (*                                      VAR S      : AnyStr;            *)
  411. (*                                          Echo   : BOOLEAN );         *)
  412. (*                                                                      *)
  413. (*           Prompt --- prompt string to be issued.                     *)
  414. (*                      If null, no prompt is issued.                   *)
  415. (*           S      --- resulting string received from remote user.     *)
  416. (*           Echo   --- TRUE to echo characters as they are read;       *)
  417. (*                      FALSE to echo characters as '.'s.  This is      *)
  418. (*                      useful for getting passwords.                   *)
  419. (*                                                                      *)
  420. (*----------------------------------------------------------------------*)
  421.  
  422. VAR
  423.    Ch      : CHAR;
  424.    GotChar : BOOLEAN;
  425.    XPos    : INTEGER;
  426.    Rem_Ch  : CHAR;
  427.  
  428. BEGIN (* Host_Prompt_And_Read_String *)
  429.  
  430.                                    (* Send prompt to remote user *)
  431.    IF LENGTH( Prompt ) > 0 THEN
  432.       Host_Send_String_And_Echo( Prompt );
  433.  
  434.    Ch      := CHR( 0 );
  435.    S       := '';
  436.    XPos    := WhereX;
  437.                                    (* Get response string        *)
  438.    REPEAT
  439.  
  440.       GotChar := FALSE;
  441.  
  442.       IF KeyPressed THEN
  443.          BEGIN
  444.             READ( Kbd, Ch );
  445.             GotChar := TRUE;
  446.          END;
  447.  
  448.       IF Async_Receive( Rem_Ch ) THEN
  449.          BEGIN
  450.             Ch      := Rem_Ch;
  451.             GotChar := TRUE;
  452.          END;
  453.  
  454.       IF ( NOT GotChar ) THEN
  455.          GiveAwayTime( 2 )
  456.       ELSE
  457.          IF Ch <> CHR( CR ) THEN
  458.             IF Ch = ^H THEN
  459.                BEGIN  (* Backspace *)
  460.                   IF WhereX > Xpos THEN
  461.                      BEGIN
  462.                         Host_Send( Ch  );
  463.                         Host_Send( ' ' );
  464.                         Host_Send( Ch  );
  465.                         IF LENGTH( S ) > 1 THEN
  466.                            S := COPY( S, 1, LENGTH( S ) - 1 )
  467.                         ELSE
  468.                            S := '';
  469.                      END;
  470.                END   (* Backspace *)
  471.             ELSE
  472.                IF ( Ch <> ^X ) THEN
  473.                   BEGIN
  474.                      S := S + Ch;
  475.                      IF Echo THEN
  476.                         Host_Send( Ch )
  477.                      ELSE
  478.                         Host_Send( '.' );
  479.                   END;
  480.  
  481.    UNTIL ( Ch = CHR( CR ) ) OR
  482.          ( Ch = ^X        ) OR
  483.          ( NOT Host_Carrier_Detect );
  484.  
  485.                                    (* CR ends line *)
  486.    IF ( Ch = ^X ) THEN
  487.       BEGIN
  488.          S := ^X;
  489.          Host_Send_String_And_Echo(' *** Cancelled');
  490.          WRITELN;
  491.       END
  492.    ELSE IF Host_Carrier_Detect THEN
  493.       BEGIN
  494.  
  495.          WRITELN;
  496.  
  497.          IF Printer_On THEN
  498.             WRITELN( Lst , Write_Ctrls( S ) );
  499.  
  500.          IF Capture_On THEN
  501.             WRITELN( Capture_File , S );
  502.  
  503.       END;
  504.  
  505. END   (* Host_Prompt_And_Read_String *);
  506.  
  507. (*----------------------------------------------------------------------*)
  508. (*           Host_Status --- update status line in host mode            *)
  509. (*----------------------------------------------------------------------*)
  510.  
  511. PROCEDURE Host_Status( Message : ShortStr );
  512.  
  513. (*----------------------------------------------------------------------*)
  514. (*                                                                      *)
  515. (*     Procedure:  Host_Status                                          *)
  516. (*                                                                      *)
  517. (*     Purpose:    Update status line in host mode                      *)
  518. (*                                                                      *)
  519. (*     Calling Sequence:                                                *)
  520. (*                                                                      *)
  521. (*        Host_Status( Message : ShortStr );                            *)
  522. (*                                                                      *)
  523. (*           Message    --- Text to display on status line              *)
  524. (*                                                                      *)
  525. (*----------------------------------------------------------------------*)
  526.  
  527. BEGIN (* Host_Status *)
  528.  
  529.    IF ( LENGTH( Message ) < 15 ) THEN
  530.       Write_To_Status_Line( Message + DUPL( ' ' , 15 - LENGTH( Message ) ) , 65 )
  531.    ELSE
  532.       Write_To_Status_Line( COPY( Message, 1, 15 ) , 65 );
  533.  
  534. END   (* Host_Status *);
  535.  
  536. (*----------------------------------------------------------------------*)
  537. (*           List_Prompt --- prompt for end-of-screen                   *)
  538. (*----------------------------------------------------------------------*)
  539.  
  540. PROCEDURE List_Prompt( VAR List_Count : INTEGER; VAR List_Done : BOOLEAN );
  541.  
  542. (*----------------------------------------------------------------------*)
  543. (*                                                                      *)
  544. (*     Procedure:  List_Prompt                                          *)
  545. (*                                                                      *)
  546. (*     Purpose:    Issues end-of-screen prompt for view routines        *)
  547. (*                                                                      *)
  548. (*     Calling Sequence:                                                *)
  549. (*                                                                      *)
  550. (*        List_Prompt( VAR List_Count : INTEGER;                        *)
  551. (*                     VAR List_Done  : BOOLEAN );                      *)
  552. (*                                                                      *)
  553. (*           List_Done  --- TRUE if Stop option selected here           *)
  554. (*           List_Count --- Count of lines per panel.  May be changed   *)
  555. (*                          here if C option selected.                  *)
  556. (*                                                                      *)
  557. (*     Calls:   RvsVideoOn                                              *)
  558. (*              RvsVideoOff                                             *)
  559. (*                                                                      *)
  560. (*     Called by:                                                       *)
  561. (*                                                                      *)
  562. (*        List_Files_For_Transfer                                       *)
  563. (*        Read_Messages                                                 *)
  564. (*                                                                      *)
  565. (*----------------------------------------------------------------------*)
  566.  
  567. VAR
  568.    List_Char : CHAR;
  569.    Found_Char: BOOLEAN;
  570.  
  571. CONST
  572.    List_Prompt_String : STRING[59] =
  573.                         'Enter <CR> to continue, S to stop, C to continue non-stop: ';
  574.  
  575. BEGIN (* List_Prompt *)
  576.  
  577.    List_Count := List_Count + 1;
  578.  
  579.    IF List_Count > Page_Size THEN
  580.       BEGIN (* Do end of screen prompt *)
  581.  
  582.          REPEAT
  583.  
  584.             Host_Send_String_And_Echo( List_Prompt_String );
  585.  
  586.             REPEAT
  587.                Found_Char := Async_Receive( List_Char ) OR KeyPressed;
  588.                IF ( NOT Found_Char ) THEN
  589.                   GiveAwayTime( 2 );
  590.                Update_Status_Line;
  591.             UNTIL ( Found_Char OR ( NOT Host_Carrier_Detect ) );
  592.  
  593.             IF KeyPressed THEN
  594.                READ( KBD, List_Char );
  595.  
  596.             IF List_Char = CHR( CR ) THEN
  597.                List_Char := ' ';
  598. {
  599.             Host_Send_String( List_Char );
  600.             Host_Send_String( CHR( CR ) );
  601. }
  602.             Host_Send_String_With_CR( List_Char );
  603.  
  604.             IF Printer_On THEN
  605.                WRITELN( Lst , List_Char );
  606.  
  607.             IF Capture_On THEN
  608.                WRITELN( Capture_File , List_Char );
  609.  
  610.             List_Char := UpCase( List_Char );
  611.  
  612.          UNTIL ( List_Char IN ['S', 'C', ' '] ) OR ( NOT Host_Carrier_Detect );
  613.  
  614.          CASE List_Char Of
  615.             'C':  List_Count := -MaxInt;
  616.             'S':  List_Done  := TRUE;
  617.             ' ':  List_Count := 1;
  618.             ELSE
  619.                   ;
  620.          END (* CASE *);
  621.  
  622.       END (* Do end of screen prompt *);
  623.  
  624. END  (* List_Prompt *);
  625.  
  626. (*----------------------------------------------------------------------*)
  627. (*            End_Prompt --- prompt for end of message batch            *)
  628. (*----------------------------------------------------------------------*)
  629.  
  630. PROCEDURE End_Prompt( Mess: AnyStr );
  631.  
  632. (*----------------------------------------------------------------------*)
  633. (*                                                                      *)
  634. (*     Procedure:  End_Prompt                                           *)
  635. (*                                                                      *)
  636. (*     Purpose:    Issues prompt at end of message batch                *)
  637. (*                                                                      *)
  638. (*     Calling Sequence:                                                *)
  639. (*                                                                      *)
  640. (*        End_Prompt( Mess : AnyStr );                                  *)
  641. (*                                                                      *)
  642. (*           Mess --- Message to issue                                  *)
  643. (*                                                                      *)
  644. (*     Calls:   RvsVideoOn                                              *)
  645. (*              RvsVideoOff                                             *)
  646. (*                                                                      *)
  647. (*----------------------------------------------------------------------*)
  648.  
  649. VAR
  650.    List_Char : CHAR;
  651.    Found_Char: BOOLEAN;
  652.  
  653. BEGIN (* List_Prompt *)
  654.  
  655.    Host_Send_String_With_CR(' ');
  656.    Host_Send_String_And_Echo( Mess );
  657.  
  658.    REPEAT
  659.       Found_Char := Async_Receive( List_Char ) OR KeyPressed;
  660.       IF ( NOT Found_Char ) THEN
  661.          GiveAwayTime( 2 );
  662.    UNTIL ( Found_Char OR ( NOT Host_Carrier_Detect ) );
  663.  
  664.    IF KeyPressed THEN
  665.       READ( KBD, List_Char );
  666.  
  667.    IF List_Char = CHR( CR ) THEN
  668.       List_Char := ' ';
  669.  
  670.    Host_Send_String_With_CR( List_Char );
  671.  
  672.    IF Printer_On THEN
  673.       WRITELN( Lst , List_Char );
  674.    IF Capture_On THEN
  675.       WRITELN( Capture_File , List_Char );
  676.  
  677. END  (* List_Prompt *);
  678.  
  679. (*----------------------------------------------------------------------*)
  680. (*                   Gossip_Mode --- Enter PibTerm gossip mode          *)
  681. (*----------------------------------------------------------------------*)
  682.  
  683. PROCEDURE Gossip_Mode;
  684.  
  685. (*----------------------------------------------------------------------*)
  686. (*                                                                      *)
  687. (*     Procedure:  Gossip_Mode                                          *)
  688. (*                                                                      *)
  689. (*     Purpose:    Allows "conversation" with remote user.              *)
  690. (*                                                                      *)
  691. (*     Calling Sequence:                                                *)
  692. (*                                                                      *)
  693. (*        Gossip_Mode;                                                  *)
  694. (*                                                                      *)
  695. (*     Remarks:                                                         *)
  696. (*                                                                      *)
  697. (*         This gossip mode feature does not use a split screen.        *)
  698. (*                                                                      *)
  699. (*----------------------------------------------------------------------*)
  700.  
  701. VAR
  702.    Gossip_Done : BOOLEAN           (* TRUE to exit back to host mode       *);
  703.    Ch          : CHAR              (* Character read/written               *);
  704.    Bozo        : BOOLEAN;
  705.  
  706. BEGIN (* Gossip_Mode *)
  707.  
  708.    Write_Log( 'Entered gossip mode.', FALSE, FALSE );
  709.  
  710.    Host_Status('Gossip mode');
  711.  
  712.    Host_Send_String_With_CR(' ');
  713.    Host_Send_String_With_CR('Entering gossip mode, hit ^X to exit ... ');
  714.    WRITELN('Hit ^X to exit gossip mode.');
  715.  
  716.    Gossip_Done := FALSE;
  717.                                    (* Loop over input until done *)
  718.    WHILE ( NOT Gossip_Done ) DO
  719.       BEGIN
  720.                                    (* Check for character typed at keyboard *)
  721.          IF KeyPressed THEN
  722.             BEGIN
  723.  
  724.                READ( Kbd , Ch );
  725.  
  726.                IF ( ORD( Ch ) = ESC ) AND KeyPressed THEN
  727.                   BEGIN
  728.                      READ( Kbd, Ch );
  729.                      CASE ORD( Ch ) OF
  730.                         F1 : Ch := CHR( 3 );
  731.                         F2 : BEGIN
  732.                                 Ch   := CHR( 3 );
  733.                                 Done := TRUE;
  734.                              END;
  735.                         F3 : BEGIN
  736.                                 DosJump('');
  737.                                 Ch := CHR( 0 );
  738.                              END;
  739.                         F5 : BEGIN
  740.                                 WRITELN;
  741.                                 WRITELN('Current caller is ',Cur_User_Name);
  742.                                 Ch := CHR( 0 );
  743.                              END;
  744.                      END (* CASE *);
  745.                   END;
  746.  
  747.                CASE ORD( Ch ) OF
  748.  
  749.                    0:   ;
  750.  
  751.                    3,
  752.                    24:  Gossip_Done := TRUE;
  753.  
  754.                   BS:   BEGIN
  755.                            Ch := BS_Char;
  756.                            Host_Send( Ch );
  757.                            IF Printer_On THEN
  758.                               WRITE( Lst , Ch );
  759.                            IF Capture_On THEN
  760.                               WRITE( Capture_File , Ch );
  761.                         END;
  762.  
  763.                   DEL:  BEGIN
  764.                            Ch := Ctrl_BS_Char;
  765.                            Host_Send( Ch );
  766.                            IF Printer_On THEN
  767.                               WRITE( Lst , Ch );
  768.                            IF Capture_On THEN
  769.                               WRITE( Capture_File , Ch );
  770.                         END;
  771.  
  772.                   CR:   BEGIN
  773.                            Host_Send_String( CR_LF_Host );
  774.                            IF Printer_On THEN
  775.                               WRITELN( Lst );
  776.                            IF Capture_On THEN
  777.                               WRITELN( Capture_File );
  778.                         END;
  779.  
  780.                   ELSE
  781.                         BEGIN
  782.                            Host_Send( Ch );
  783.                            IF Printer_On THEN
  784.                               WRITE( Lst , Ch );
  785.                            IF Capture_On THEN
  786.                               WRITE( Capture_File , Ch );
  787.                         END;
  788.  
  789.                END (* CASE ORD( Ch ) *);
  790.  
  791.             END;
  792.  
  793.          IF Async_Receive( Ch ) THEN
  794.             BEGIN
  795.                IF ( Ch = ^X ) THEN
  796.                   Gossip_Done := TRUE
  797.                ELSE IF Ch = CHR( CR ) THEN
  798.                   BEGIN
  799.                      IF Printer_On THEN
  800.                         WRITELN( Lst );
  801.                      IF Capture_On THEN
  802.                         WRITELN( Capture_File );
  803.                      Host_Send_String( CR_LF_Host );
  804.                   END
  805.                ELSE
  806.                   Host_Send( Ch );
  807.             END
  808.          ELSE
  809.             IF ( NOT KeyPressed ) THEN
  810.                GiveAwayTime( 2 );
  811.  
  812.       END;
  813.  
  814.    Host_Section := Last_Host_Sect;
  815.  
  816.    Host_Status( Cur_Host_Status );
  817.    Write_Log( 'Exited gossip mode.', FALSE, FALSE );
  818.  
  819. END   (* Gossip_Mode *);
  820.  
  821.